##
# makefile - Created by Timothy Morey on 8/9/11.
#

LINKS = -lglut -lpthread

OBJS = communication_queue.o \
       device_controller.o \
       glut_display.o \
       main.o \
       parts.o \
       renderer.o \
       simulator.o \
       vis_server.o

FLOAT_SUPPORT = -D DoF=float -arch=compute_10
#FLOAT_SUPPORT = -D DoF=double -arch=compute_13

COMPILE_OPTS = -c -g -G $(FLOAT_SUPPORT)
LINK_OPTS = -g -G $(LINKS)

parts : $(OBJS)
	nvcc $(OBJS) $(LINK_OPTS) -o parts

communication_queue.o : communication_queue.cpp communication_queue.h \
                        message.h
	nvcc $(COMPILE_OPTS) communication_queue.cpp

device_controller.o : device_controller.cu device_controller.h \
                      parts.cuh \
                      simulator.h
	nvcc $(COMPILE_OPTS) device_controller.cu

glut_display.o : glut_display.cpp glut_display.h \
                 communication_queue.h \
                 message.h \
                 simulator.h
	nvcc $(COMPILE_OPTS) glut_display.cpp

main.o : main.cpp \
         glut_display.h \
         simulator.h \
         ../common/vis_server.h
	nvcc $(COMPILE_OPTS) main.cpp

parts.o : parts.cu parts.cuh \
          ../common/cuda.cuh
	nvcc $(COMPILE_OPTS) parts.cu

renderer.o : renderer.cu renderer.h \
             parts.cuh \
             simulator.h \
             ../common/vis_server.h
	nvcc $(COMPILE_OPTS) renderer.cu

simulator.o : simulator.cu simulator.h \
              device_controller.h \
              glut_display.h \
              message.h \
              parts.cuh \
              ../common/vis_server.h
	nvcc $(COMPILE_OPTS) simulator.cu

vis_server.o : ../common/vis_server.cpp ../common/vis_server.h
	nvcc $(COMPILE_OPTS) ../common/vis_server.cpp

clean :
	rm -v -f parts *.o *~ *.gch
